package com.project.lk.nurseapp.login.presenter;


import com.project.lk.nurseapp.base.BasePresenter;
import com.project.lk.nurseapp.base.ModelPresenterBridge;
import com.project.lk.nurseapp.login.model.LoginModel;
import com.project.lk.nurseapp.login.model.UserBean;

import java.util.List;

import static com.project.lk.nurseapp.base.BaseApi.login_fail;
import static com.project.lk.nurseapp.base.BaseApi.login_success;

/**
 * 功能介绍：
 * 项目名：
 * 模块名称：
 * 作者：LK
 * 日期：2018/1/9
 * 修改日期：
 */
public class LoginPresenter extends BasePresenter<ILoginView> implements ModelPresenterBridge<UserBean> {

    LoginModel loginModel;
    public LoginPresenter(ILoginView view){
        loginModel=new LoginModel();
        addView(view);
        loginModel.setBridge(this);
    }

    //请求登录
    public void postLogin(String url,String phone,String psw,String logintype,String openid,String nickname,String headimg){
        loginModel.postLoadJson(url,phone,psw,logintype,openid,nickname,headimg);
    }
    //请求微信登录
//    public void postWxLogin(String url,String openid,String nickname,String headimg){
//        wxLoginModel.postLoadJson(url,openid,nickname,headimg);
//    }
    @Override
    public void bridge(int action,List<UserBean> list) {
        if (view!=null) {
            switch (action){
                case login_success:
                    view.loginSuccess(list);
                    break;
                case login_fail:
                    view.loginFail();
                    break;

            }
        }

    }

}
